package com.jiazhong.example.project.bookstore.backend.controller;

import com.jiazhong.example.project.bookstore.backend.service.SeckillService;
import com.jiazhong.example.project.bookstore.commons.bean.Seckill;
import com.jiazhong.example.project.bookstore.commons.util.JsonResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/seckill")
public class SeckillController {
    @Resource
    private SeckillService seckillService;

    @PostMapping("/add")
    public JsonResult add(Seckill seckill) {
        return seckillService.addSeckill(seckill);
    }

    @GetMapping("/find_all")
    public JsonResult findAll() {
        return seckillService.findAll();
    }

    @GetMapping("/find")
    public JsonResult find() {
        return seckillService.find();
    }
}
